package com.domain.pojo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 大忽悠
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
public class CityNode {
    /**
     * 属于当前城市节点的名字
     */
    private String cityName;
    /**
     * 从当前城市做飞机能抵达的城市列表
     */
    private List<CityNodeWrapper> nextCityNodeList;

    public CityNode addNextCityNode(String cityArrive, Integer flightId){
        CityNodeWrapper cityNodeWrapper = CityNodeWrapper.builder().cityNode(CityNode.builder().cityName(cityArrive).build()).flightId(flightId).build();
        if(nextCityNodeList==null){
            nextCityNodeList=new ArrayList<>();
        }
        nextCityNodeList.add(cityNodeWrapper);
        return cityNodeWrapper.getCityNode();
    }

    /**
     * 额外增加航班信息
     */
    @AllArgsConstructor
    @NoArgsConstructor
    @Data
    @Builder
    public static class CityNodeWrapper{
        private CityNode cityNode;
        private Integer flightId;
    }
}
